<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>

<head>
    <meta charset="UTF-8">
    <title>单模块多行多列</title>
    <meta name="page-view-size" content="1280*720">
    <link rel="stylesheet" href="css/base.css">
    <link rel="stylesheet" href="css/order_meal.css">
    <script type="text/javascript" src="lib/js/evm.js"></script>
    <script type="text/javascript" src="lib/js/Evm_djyw.js"></script>
    <script type="text/javascript" src="lib/js/key.js"></script>
    <script src="lib/js/jquery-1.11.1.min.js" type="text/javascript" charset="utf-8"></script>
    <script src="lib/js/jquery.cookie.js" type="text/javascript" charset="utf-8"></script>
    <script src="js/api.js" type="text/javascript" charset="utf-8"></script>
    <script src="js/public.js" type="text/javascript" charset="utf-8"></script>
    <script src="js/model.js"></script>
    <style>

    </style>
</head>

<body>
    <div class="theoretical-bg" id="helpMain">
        <div class="erweima_bg">
            <div class="erweima">
                <img src="images\qjy8090\erweima.png">
            </div>
            <img src="images\qjy8090\4241.png">
        </div>
        <div class="list-bg">
            <div class="list-con" id="list-con">
            </div>
            <div class="list-bottom">
                <div class="page-show" id="page_show">
                    <span id="now_page">0</span>
                    <span>/</span>
                    <span id="total_page">0</span>
                </div>
            </div>
        </div>
        <!-- <div class="toptitle">问卷调查</div> -->
    </div>

</body>
<script>
    var sourceName = TV.GetParam("model")
    console.log(sourceName);
    var modelIndex = {
        disUser: true,
        index: 0, //初始位置
        pageSize: dataIndex[sourceName].size,
        type: dataIndex[sourceName].type_style,
        listName: dataIndex[sourceName].list_name, //模块名称
        containerId: 'list-con', //包含模块的标签id
    }

    function getMessage(page, pageSize, pos, index) {
        var param = {
            page: page,
            pagesize: pageSize,
            cid: dataIndex[sourceName].id,
            area_id: TV.GetParam('area_id'),
            device: 'tv'
        }
        if (dataIndex[sourceName].api == "getActivityList") {
            var param = {
                page: page,
                pagesize: pageSize,
                cid: dataIndex[sourceName].id,
                is_volunteer: dataIndex[sourceName].is_volunteer,
                area_id: TV.GetParam('area_id'),
                device: 'tv'
            }
        }

        GetDatas(dataIndex[sourceName].api, param, function(err, res) {
                var mess = [];

                for (var i = 0; i < res.data.items.length; i++) {
                    var v = res.data.items[i]
                    mess.push({
                        id: v.third_id || v.volunteerID || v.id || v.cur_period,
                        img: v.img ? v.img : (v.images ? v.images : (v.logo ? v.logo : "")),
                        number: v.rank,
                        status: v.status,
                        format_end_time: v.format_end_time,
                        format_start_time: v.format_start_time,
                        source: v.time || v.activty_time || v.serviceTime,
                        tpe: v.tpe,
                        tpe_name: v.tpe_name,
                        video_path: v.video_path,
                        title: v.name || v.title
                    })

                }
                console.log(mess, 'mess')
                var str = '';

                // console.log(mess[1].tpe_name);
                if (mess.length > 0) {
                    if (dataIndex[sourceName].list_name == "list-video") {
                        for (var i = 0; i < mess.length; i++) {
                            str += "<div class='" + dataIndex[sourceName].list_name + "' data-id=" + mess[i].id + " tpe=" + mess[i].tpe + "  videopath=" + mess[i].video_path + ">";
                            str += "<img class='img' src=" + (((mess[i].img.substr(0, 1)) == "/") ? (API_URL.imgURL + mess[i].img) : (mess[i].img || "/images/nonePic.png")) + ">"
                            if (dataIndex[sourceName].api == "getArticleList") {
                                if (mess[i].tpe == 1) {
                                    str += '<div class="list-flag flag1">' + "文章" + "</div>"
                                } else if (mess[i].tpe == 2) {
                                    str += '<div class="list-flag flag2">' + "图文" + "</div>"
                                } else if (mess[i].tpe == 3) {
                                    str += '<div class="list-flag flag3">' + "图集" + "</div>"
                                } else if (mess[i].tpe == 4) {
                                    str += '<div class="list-flag flag4">' + "视频" + "</div>"
                                } else if (mess[i].tpe == 5) {
                                    str += '<div class="list-flag flag5">' + "直播" + "</div>"
                                }
                            }
                            // 隐藏了
                            str += "<div class='list-title'><div class='sb'>" + mess[i].title + "</div></div>";
                            str += "</div>"
                        }
                    } else if (dataIndex[sourceName].list_name == "list-row") {
                        for (var i = 0; i < mess.length; i++) {
                            str += "<div class='" + dataIndex[sourceName].list_name + "' data-id=" + mess[i].id + " tpe=" + mess[i].tpe + ">";
                            str += "<img class='img' src=" + (mess[i].img || "/images/nonePic.png") + ">"
                                // 隐藏了
                            str += "<div class='list-title'><div class='sb'>" + mess[i].title + "</div></div>";
                            str += "<div class='row-time'>" + mess[i].format_start_time + "至" + mess[i].format_end_time + "</div>";
                            str += "<div class='row-status'>" + "<img src=images/rowstatus" + mess[i].status + ".png></div>";
                            str += "</div>"
                        }
                    } else if (dataIndex[sourceName].list_name == "list-line") {
                        for (var i = 0; i < mess.length; i++) {
                            str += "<div class='" + dataIndex[sourceName].list_name + "' data-id=" + mess[i].id + " tpe=" + mess[i].tpe + ">";
                            //内容 
                            str += "<div class='list-title'><div class='sb'>";
                            str += mess[i].title;
                            str += "</div>";
                            str += "</div>";
                            //后缀
                            str += "<div class='line-time'>";
                            if (mess[i].tpe_name == "惠民政策") {
                                str += "<div class='tpe_name backcolor_O'>";
                                str += mess[i].tpe_name;
                                str += "</div>";
                                str += "<div class = 'tpe_cornule bordercolor_O'></div>"
                            } else if (mess[i].tpe_name == "创新理论") {
                                str += "<div class='tpe_name backcolor_B'>";
                                str += mess[i].tpe_name;
                                str += "</div>";
                                str += "<div class = 'tpe_cornule bordercolor_B'></div>"
                            } else if (mess[i].tpe_name == "生态文明") {
                                str += "<div class='tpe_name backcolor_R'>";
                                str += mess[i].tpe_name;
                                str += "</div>";
                                str += "<div class = 'tpe_cornule bordercolor_R'></div>"
                            } else {
                                str += "<div class='tpe_name backcolor_P'>";
                                str += mess[i].tpe_name;
                                str += "</div>";
                                str += "<div class = 'tpe_cornule bordercolor_P'></div>"
                            }

                            str += "</div>";
                            str += "</div>";
                            var tpe_color = mess[i].tpe_name;
                        }
                    } else if (dataIndex[sourceName].list_name == "list-rank") {
                        str = "<div class=rank-title>"
                        str += "<div class=order_title>序号</div>"
                        str += "<div class=name_title>姓名</div>"
                        str += "<div class=number_title>志愿者组织编号</div>"
                        str += "<div class=time_title>服务时长(h)</div>"
                        str += "</div>"
                        for (var i = 0; i < mess.length; i++) {
                            str += "<div class='" + dataIndex[sourceName].list_name + "' data-id=" + mess[i].id + " tpe=" + mess[i].tpe + ">";
                            // str += "<div class=rank-order>"+mess[i].rank+"</div>"
                            str += "<div class=rank-order>"
                            str += mess[i].number == 1 ? "<img src='images/rank1.png'>" : mess[i].number == 2 ? "<img src='images/rank2.png'>" : mess[i].number == 3 ? "<img src='images/rank3.png'>" : mess[i].number;
                            str += "</div>"
                            str += "<div class=rank-name>" + mess[i].title + "</div>"
                            str += "<div class=rank-number>" + mess[i].id + "</div>"
                            str += "<div class=rank-time>" + mess[i].source + "</div>"
                            str += "</div>"
                        }
                    }
                } else {
                    str += '<div class="noneData"><img src=images/no.png></div>';
                }
                $("#list-con").html(str);
                $("#now_page").html(page);
                $("#total_page").html(res.data.totalpage)
                right.index = index ? index : pos == 'previous' ? pageSize - 1 : 0;
                right.initialization();
                right.toggleFocus(right.index);
            })
            // right.toggleFocus();
    }



    function direEnter(index) {
        if (dataIndex[sourceName].api == "getArticleList") { //资讯列表页
            type = parseInt($(".active")[0].getAttribute('tpe'));
            switch (type) {
                case 1: //文章
                case 2: //图文
                case 3: //图集
                    window.location.href = 'detailHasPicture.html?id=' + $('.active').attr('data-id');
                    break;
                case 4: //视频
                    window.location.href = 'play.html?id=' + $('.active').attr('data-id') + "&mediaStr=" + $('.active').attr('video_path_tv');
                    break;
                case 5: //直播
                    window.location.href = 'play.html?id=' + $('.active').attr('data-id') + "&mediaStr=" + $('.active').attr('video_path_tv');
                    break;
            }
        } else if (dataIndex[sourceName].api == "getActivityList") { //活动列表页
            status = parseInt($(".active")[0].getAttribute('status'));
            window.location.href = 'B_detailActivety.html?titles=志愿活动&id=' + $('.active').attr('data-id');
        } else if (dataIndex[sourceName].api == "volunteerList") { //志愿团队列表页
            window.location.href = ' A_teamGroupDetail.html?titles=志愿者团队&id=' + $('.active').attr('data-id');
        } else if (dataIndex[sourceName].api == "helpList") { //自助点单列表
            window.location.href = ' selfHelpOrder.html?titles=自助点单&order_id=' + $('.active').attr('data-id');
        } else if (dataIndex[sourceName].api == "goodList") { //商品列表
            TV.PromptMsg("兑换成功");
        } else if (dataIndex[sourceName].api == "diy") { //文明创建的diy模块
            window.location.href = 'A_SingleList.html?model=' + diyArry[index].model + "&titles=" + diyArry[index].name;
        } else if (dataIndex[sourceName].api == "areaList") { //文明创建的diy模块
            window.location.href = 'D_civilization_practice.html?titles=所站风采&area_id=' + $('.active').attr('data-id');
        } else if (dataIndex[sourceName].api == "orderList") { //实践点单
            window.location.href = 'order_List.html?titles=点单8090&order_id=' + $('.active').attr('data-id');
            console.log($('.active').attr('data-id'));
            // GetDatas('orderSure', {
            //     period_id: $('.active').attr('data-id'),
            //     token: $.cookie('TV_CST_TOKEN'),
            // }, function(err, res) {
            //     console.log(res, 'ressssss')
            //     if (res.code == 0) {
            //         TV.PromptMsg('点单成功')
            //     } else if (res.code == 401) {
            //         var message = res.message
            //         TV.PromptMsg(message)
            //         setTimeout(function() {
            //             window.location.href = './login.html';
            //         }, 2500)
            //     } else {
            //         var message = res.message
            //         TV.PromptMsg(message)
            //     }
            // })
        } else if (dataIndex[sourceName].api == "" || dataIndex[sourceName].api == "myRecordList") { //我的积分兑换记录
        } else {}
    }
</script>
<script type="text/javascript" src="js/pageList.js"></script>

</html>